import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-09-17
 * Time: 20:15
 */
class Uav{
    public int no;
    public double x;
    public double y;
    public int type;

    public Uav(int no, double x, double y, int type){
        this.no = no;  //无人机编号
        this.x = x;
        this.y = y;
        this.type = type;  //无人机类型
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        Uav uav0 = new Uav(0, 0, 0, 1);

        //建立FY01无人机
        System.out.println("分别输入FY01 xy坐标：");
        double x1 = scanner.nextDouble();
        double y1 = scanner.nextDouble();
        Uav uav1 = new Uav(1, x1, y1, 1);
        double r = Math.sqrt(x1 * x1 + y1 * y1);

        //建立FY02无人机
        //角度由无人机其他定位设备输入
        System.out.println("输入圆心角：");
        //圆心角
        double angel2 = scanner.nextDouble();

        double tmp = Math.toRadians(angel2);

        double x2 = r * Math.cos(tmp);
        double y2 = r * Math.sin(tmp);
            /*double x2 = scanner.nextDouble();
            double y2 = scanner.nextDouble();*/
        Uav uav2 = new Uav(2, x2, y2, 1);

        //定位自身无人机
        System.out.print("无人机编号为：FY0i(请输入i的值)>");
        int i = scanner.nextInt();

        double cta = 0;

        //由无人机自行判断输入
        System.out.println("输入1：0k1， 0：1k0");
        int n = scanner.nextInt();

        System.out.println("输入无人机∠1k2：");
        double angel1k2 = scanner.nextDouble();
        System.out.println("输入无人机∠1k0：");
        double angel = scanner.nextDouble();

        double Angel = Math.toRadians(angel);

        /*if(n == 0){
            double angel1k0 = scanner.nextDouble();
        }else{
            double angel0k1 = scanner.nextDouble();
        }*/

        System.out.println("输入无人机∠0k2：");
        double angel0k2 = scanner.nextDouble();

        //由无人机的测距设备输入
        System.out.println("分别输入lk1和lk0的长度：");
        double lk1 = scanner.nextDouble();
        double lk0 = scanner.nextDouble();

        //输入公式进行计算
        double temp = lk1 * Math.sin(Angel) / r;
        cta = Math.toDegrees(Math.asin(temp));


        //判断无人机所在位置为一、二象限或三、四象限
        if(n == 1){
            cta = -cta;
        }

        double Cta = Math.toRadians(cta);

        double X = lk0 * Math.cos(Cta);
        double Y = lk0 * Math.sin(Cta);

        if(lk0 < lk1){
            X = -X;
        }

        Uav uav = new Uav(i, X, Y, 0);

        //打印无人机的计算坐标
        System.out.println("现在FY0" + i + "无人机的坐标为：(" + uav.x + "," + uav.y + ")");

    }
}
